package cn.com.baiwei.util;

/**
 * @program: baiweicanyin
 * @description:
 * @author: X_Q
 * @create: 2021-09-18 15:41
 **/
public class ZZUtil {
    //验证手机号
    public static final String REGEX_MOBILE = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(17[013678])|(18[0,5-9]))\\d{8}$";
    //验证身份证
    public static final String REGEX_ID = "^\\d{15}|\\d{18}$";
    //验证正整数
    public static final String REGEX_INTEGER = "^([1-9]+\\\\d*)|[0]";

    /**
     * 验证手机号是否合法
     * @param phone	手机号
     * @return  boolean true合法 false不合法
     */
    public static  boolean isPhone(String phone){
        if (phone.matches(REGEX_MOBILE)){
            return true;
        }else {
            return false;
        }
    }

    public static  boolean isIdCard(String iDCard){
        if (iDCard.matches(REGEX_ID)){
            return true;
        }else {
            return false;
        }
    }

    public static  boolean isInteger(String number){
        if (number.matches(REGEX_INTEGER)){
            return true;
        }else {
            return false;
        }
    }

}
